package com.wlr.study.leetcode;

/**
 * @author lerong.wang
 * @version 1.0.0
 * @description
 * @date 2024/8/29 16:09
 */
public class LeetCode3142 {

    public static boolean satisfiesConditions(int[][] grid) {
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[i].length; j++) {
                if (i + 1 < grid.length && grid[i][j] != grid[i + 1][j]) {
                    return false;
                }
                if (j + 1 < grid[0].length && grid[i][j] == grid[i][j + 1]) {
                    return false;
                }
            }
        }
        return true;
    }

    public static void main(String[] args) {
        int[][] arr = {{1,0,2},{1,0,2}};
        boolean b = LeetCode3142.satisfiesConditions(arr);
        System.out.println(b);
    }

}